<!doctype html>
<html lang="en">
<head>
    @include('wap.layout.head')
    <link rel="stylesheet" href="{{asset('/css/wap/perfectinfo.css')}}">
    <script src="{{asset('/frame/mui.picker.js')}}"></script>
    <script src="{{asset('/frame/mui.poppicker.js')}}"></script>
    <link href="{{asset('/frame/mui.picker.css')}}" rel="stylesheet" />
    <link href="{{asset('/frame/mui.poppicker.css')}}" rel="stylesheet" />
</head>
<body>
<h2 class="head_top_tit">
    公司信息
</h2>
<form>
    <div class="perfect_box">
        <div class="tit">公司名称</div>
        <div class="input_box">
            <input type="text" name="corporate_name" class="corporate_name" placeholder="请认真填写公司名称">
            <span>不可修改</span>
        </div>
    </div>
    <div class="perfect_box" id="showCompanyType">
        <div class="tit">公司类型</div>
        <font>〉</font>
        <div class="choice_right fr" id="show_company_type">选择</div>
        <input type="hidden" name="company_type" value="">
    </div>
    <div class="perfect_box" id="showBusiness">
        <div class="tit">主营行业</div>
        <font>〉</font>
        <div class="choice_right fr" id="show_business">选择</div>
        <input type="hidden" name="business" value="">
    </div>
    <div class="perfect_box" id="showMainProduct">
        <div class="tit">主营产品</div>
        <font>〉</font>
        <div class="choice_right fr" id="show_mainProduct">选择</div>
        <input type="hidden" name="mainProduct" value="">
    </div>
    <h2 class="head_top_tit">
        联系方式
    </h2>
    <div class="perfect_box">
        <div class="tit">联系人</div>
        <div class="input_box">
            <input type="text" name="name" class="name" placeholder="联系人姓名">
        </div>
    </div>
    <div class="perfect_box" id="showSex">
        <div class="tit">性别</div>
        <font>〉</font>
        <div class="choice_right fr" id="show_sex">选择</div>
        <input type="hidden" name="sex" value="">
    </div>
    <div class="perfect_box">
        <div class="tit">联系手机</div>
        <div class="input_box">
            <input type="text" name="phone" class="phone" placeholder="常用联系人手机号码">
        </div>
    </div>
    <div class="btn_confirm">确认修改</div>
</form>
<script type="text/javascript">
    $(function(){
        var doc = document;
        //公司类型选择
        var companyTypePicker = new mui.PopPicker({
            layer: 1,
            titles: ["公司类型"]
        });
        companyTypePicker.setData([{
                        value: '工程商',
                        text: '工程商'
                    }, {
                        value: '集成商',
                        text: '集成商'
                    }, {
                        value: '分销商',
                        text: '分销商'
                    }]);
        var showCompanyTypeButton = doc.getElementById('showCompanyType');
        var companyTypeResult = doc.getElementById('show_company_type');
        showCompanyTypeButton.addEventListener('tap', function (event) {
            companyTypePicker.show(function (items) {
                companyTypeResult.innerText = items[0].text;
                $("input[name='company_type']").val(items[0].text)
            });
        }, false);
        //companyTypePicker.pickers[0].setSelectedValue('集成商');，//默认选中

        //主营行业
        var businessPicker = new mui.PopPicker({
            layer: 1,
            titles: ["主营行业"]
        });
        businessPicker.setData([{
                        value: '监控',
                        text: '监控'
                    }, {
                        value: '门禁',
                        text: '门禁'
                    }, {
                        value: '门禁',
                        text: '门禁'
                    }]);
        var showBusinessButton = doc.getElementById('showBusiness');
        var businessResult = doc.getElementById('show_business');
        showBusinessButton.addEventListener('tap', function (event) {
            businessPicker.show(function (items) {
                businessResult.innerText = items[0].text;
                $("input[name='business']").val(items[0].text)
            });
        }, false);

        //主营产品
        var mainProductPicker = new mui.PopPicker({
            layer: 1,
            titles: ["主营产品"]
        });
        mainProductPicker.setData([{
                        value: '监控',
                        text: '监控'
                    }, {
                        value: '门禁',
                        text: '门禁'
                    }, {
                        value: '门禁',
                        text: '门禁'
                    }]);
        var showMainProductButton = doc.getElementById('showMainProduct');
        var mainProductResult = doc.getElementById('show_mainProduct');
        showMainProductButton.addEventListener('tap', function (event) {
            mainProductPicker.show(function (items) {
                mainProductResult.innerText = items[0].text;
                $("input[name='mainProduct']").val(items[0].text)
            });
        }, false);

        //性别
        var sexPicker = new mui.PopPicker({
            layer: 1,
            titles: ["性别"]
        });
        sexPicker.setData([{
                        value: '男',
                        text: '男'
                    }, {
                        value: '女',
                        text: '女'
                    }]);
        var showSexButton = doc.getElementById('showSex');
        var sexResult = doc.getElementById('show_sex');
        showSexButton.addEventListener('tap', function (event) {
            sexPicker.show(function (items) {
                sexResult.innerText = items[0].text;
                $("input[name='sex']").val(items[0].text)
            });
        }, false);
    })
    $('.btn_confirm').click(function () {
        var corporate_name = $('input[name="corporate_name"]').val();
        if(corporate_name == ''){
            layer.msg("请填写公司名称",{time:1000});
            return false;
        }
        var company_type = $('input[name="company_type"]').val();
        if(company_type == ''){
            layer.msg("请选择公司类型",{time:1000});
            return false;
        }
        var business = $('input[name="business"]').val();
        if(business == ''){
            layer.msg("请选择主营行业",{time:1000});
            return false;
        }
        var mainProduct = $('input[name="mainProduct"]').val();
        if(mainProduct == ''){
            layer.msg("请选择主营产品",{time:1000});
            return false;
        }
        var name = $('input[name="name"]').val();
        if(name == ''){
            layer.msg("请填写联系人",{time:1000});
            return false;
        }
        var sex = $('input[name="sex"]').val();
        if(sex == ''){
            layer.msg("请选择性别",{time:1000});
            return false;
        }
        var phone = $('input[name="phone"]').val();
        if(phone == ''){
            layer.msg("请填写联系手机",{time:1000});
            return false;
        }

    })

</script>
</body>
</html>
